import request from '@/utils/request';
import defaultSettings from '@/defaultSettings';
const { usePlatform } = defaultSettings;
export async function query() {
  return request('/api/users');
}

export async function queryCurrent() {
  return request('/api/currentUser');
}
export async function checkLogin(parms) {
  let timestamp = (new Date()).valueOf();
  let url = `/iot/dmp/v1/ignore/checkUserLogin?profile=${PROFILE}&requestTime=${timestamp}`
  return request(url);
}
export async function initialization(params) { //初始化
  let url = '/iot/dmp/v1/login/getpermission';
  if (usePlatform){
      params.platform_type=PROFILE;
  }

  return request(url, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
export async function requserCasLogin() {
  // const appMode = getProfile();
  // const authCode = getQueryVariable("code");
let url = `/iot/dmp/v1/ignore/getcasserver?${usePlatform?`profile=${PROFILE}&`:``}homePage=${window.location.protocol}//${window.location.host}/`;
  /*  if(authCode){
      url = url + "&oauth_code="+authCode;
    }*/
  return request(url);
}
